$(function(){	
    	
  	$(".bigpic").jqueryzoom({
//		zoomWidth:100,
//	    zoomHeight:100,
		xzoom: 300,
		yzoom: 300,
		preload: 1,
		offset:30,
		position: "right",
		lens:true 
  	});
  	$('.smallpic li').hover(function(){
  		$(this).css({border:'1px solid orange'});
		var $src = $(this).find('img').attr('src');
  		$('.bigpic img').attr('src',$src);
  	},function(){
  		var $src = $(this).find('img').attr('src');
  		$('.bigpic img').attr('src',$src);
  		$(this).css({border:'1px solid #DFDFDF'});
  	});	
		
	//商品件数的加减	
	var index = parseInt($('.number').text())	
	$('.decrease').on('click',function(){
		if(index == 1){
			index = 1;
		}else{
			index--;
		}	
		//数量框件数
		$('.number').text(index);
	});
	$('.add').on('click',function(){	
		if(index < 1){
			index = 1;
		}else{
			index++;
		}	
		$('.number').text(index);
	});

	
	$('#car').on('click',function(){
		newA();
	})
	function newA(){
		var goodsImg = $('.bigpic img').attr('src');
		var goodsName = $('.goods h1').text();
		var goodsPrice = $('.redPrice').text();
		var numb = $('.number').text();
		var address = $('.address span').text();
		var time1 = $('.time1').text();
		var time2 = $('.time2').text();
		
		var json1 = '[{"goodsImg":" '+ goodsImg  +' ","goodsName":" ' + goodsName +',"time1":"'+time1+' ","time2":" '+time2+' ","goodsPrice":" '+goodsPrice  +'","numb":" '+  numb +'","address":" ' + address+' "}]';
		// console.log('obj',json1);	
		var obj = {};
		setCookie('obj',json1);
		var a = {};
		a = getCookie('obj');
		var value = JSON.parse(a);
		
	}
	
})
